

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/broswer.jpg">
  <link rel="icon" href="/img/broswer.jpg">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Feng Zikai">
  <meta name="keywords" content="">
  
    <meta name="description" content="1 安装 使用脚本安装  1curl -sSL https:&#x2F;&#x2F;get.daocloud.io&#x2F;docker | sh     更改权限  1sudo chmod 666 &#x2F;var&#x2F;run&#x2F;docker.soc    查看版本    更改镜像源  12cd &#x2F;etc&#x2F;dockersudo vim daemon.json	  ​	写入以下内容 12345678&amp;#123;  &quot;regist">
<meta property="og:type" content="article">
<meta property="og:title" content="配置docker">
<meta property="og:url" content="http://example.com/2022/04/18/%E9%85%8D%E7%BD%AEdocker/index.html">
<meta property="og:site_name" content="F7kyyy的博客">
<meta property="og:description" content="1 安装 使用脚本安装  1curl -sSL https:&#x2F;&#x2F;get.daocloud.io&#x2F;docker | sh     更改权限  1sudo chmod 666 &#x2F;var&#x2F;run&#x2F;docker.soc    查看版本    更改镜像源  12cd &#x2F;etc&#x2F;dockersudo vim daemon.json	  ​	写入以下内容 12345678&amp;#123;  &quot;regist">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="http://example.com/img/article/docker.png">
<meta property="article:published_time" content="2022-04-18T11:57:28.000Z">
<meta property="article:modified_time" content="2023-07-09T13:47:12.000Z">
<meta property="article:author" content="Feng Zikai">
<meta property="article:tag" content="环境配置">
<meta property="article:tag" content="云计算">
<meta property="article:tag" content="Ubuntu">
<meta property="article:tag" content="实验报告">
<meta property="article:tag" content="wsl">
<meta property="article:tag" content="docker">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="http://example.com/img/article/docker.png">
  
  
  
  <title>配置docker - F7kyyy的博客</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  



  
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">



  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.5-a","typing":{"enable":true,"typeSpeed":60,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading1.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":{"measurement_id":null},"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml","include_content_in_search":true};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.3.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>F7kyyy&#39;s blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                <span>首页</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                <span>归档</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                <span>分类</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                <span>标签</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                <span>关于</span>
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/links/">
                <i class="iconfont icon-link-fill"></i>
                <span>友链</span>
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              <i class="iconfont icon-search"></i>
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">
              <i class="iconfont icon-dark" id="color-toggle-icon"></i>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="配置docker"></span>
          
        </div>

        
          
  <div class="mt-3">
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2022-04-18 19:57" pubdate>
          2022年4月18日 晚上
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          2.1k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          18 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <h1 id="seo-header">配置docker</h1>
            
            
              <div class="markdown-body">
                
                <h2 id="1-安装"><a href="#1-安装" class="headerlink" title="1 安装"></a>1 安装</h2><ul>
<li>使用脚本安装</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">curl -sSL https://get.daocloud.io/docker | sh<br></code></pre></td></tr></table></figure>

<img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204042241275.png" srcset="/img/loading1.gif" lazyload alt="image-20220404224134678" style="zoom: 67%;" />

<ul>
<li>更改权限</li>
</ul>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo chmod 666 /var/run/docker.soc<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111623506.png" srcset="/img/loading1.gif" lazyload alt="image-20220411162329378"></p>
<ul>
<li>查看版本</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111624567.png" srcset="/img/loading1.gif" lazyload alt="image-20220411162445405"></p>
<ul>
<li>更改镜像源</li>
</ul>
<figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs awk">cd <span class="hljs-regexp">/etc/</span>docker<br>sudo vim daemon.json	<br></code></pre></td></tr></table></figure>

<p>​	写入以下内容</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><code class="hljs json"><span class="hljs-punctuation">&#123;</span><br>  <span class="hljs-attr">&quot;registry-mirrors&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-punctuation">[</span><br>    <span class="hljs-string">&quot;https://hub-mirror.c.163.com&quot;</span><span class="hljs-punctuation">,</span><br>    <span class="hljs-string">&quot;https://ustc-edu-cn.mirror.aliyuncs.com&quot;</span><span class="hljs-punctuation">,</span><br>    <span class="hljs-string">&quot;https://ghcr.io&quot;</span><span class="hljs-punctuation">,</span><br>    <span class="hljs-string">&quot;https://mirror.baidubce.com&quot;</span><br>  <span class="hljs-punctuation">]</span><br><span class="hljs-punctuation">&#125;</span><br></code></pre></td></tr></table></figure>

<p>​	重启</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">service docker restart<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111629166.png" srcset="/img/loading1.gif" lazyload alt="image-20220411162942084"></p>
<h2 id="2-docker部署mysql"><a href="#2-docker部署mysql" class="headerlink" title="2 docker部署mysql"></a>2 docker部署mysql</h2><h3 id="2-1-拉取镜像"><a href="#2-1-拉取镜像" class="headerlink" title="2.1 拉取镜像"></a>2.1 拉取镜像</h3><ul>
<li>在<a target="_blank" rel="noopener" href="https://registry.hub.docker.com/_/mysql?tab=tags">dockerhub</a>选合适版本</li>
</ul>
<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111635301.png" srcset="/img/loading1.gif" lazyload alt="image-20220411163511252"></p>
<ul>
<li>拉取镜像</li>
</ul>
<figure class="highlight dockerfile"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs dockerfile">docker pull mysql:<span class="hljs-number">8.0</span>.<span class="hljs-number">28</span>-oracle<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111637821.png" srcset="/img/loading1.gif" lazyload alt="image-20220411163721573"></p>
<ul>
<li>查看镜像</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">docker images<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111638702.png" srcset="/img/loading1.gif" lazyload alt="image-20220411163851617"></p>
<h3 id="2-2-启动实例"><a href="#2-2-启动实例" class="headerlink" title="2.2 启动实例"></a>2.2 启动实例</h3><ul>
<li>启动mysql实例</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">docker run --name some-mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:tag<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111643276.png" srcset="/img/loading1.gif" lazyload alt="image-20220411164304227"></p>
<ul>
<li>进入docker环境</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">docker <span class="hljs-built_in">exec</span> -ti xxx(容器<span class="hljs-built_in">id</span>) /bin/bash<br></code></pre></td></tr></table></figure>

<ul>
<li>登录mysql</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">mysql -u root -p<br></code></pre></td></tr></table></figure>

<p>​		输入密码，登陆成功</p>
<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111653219.png" srcset="/img/loading1.gif" lazyload alt="image-20220411165314050"></p>
<ul>
<li>创建数据库，插入数据</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs mysql">create database dockertest;<br>use dockertest;<br>create table dt(name varchar(20), ID varchar(20));<br>insert into dt values(&#x27;mysql 8.0.28&#x27;,&#x27;0ca4d64ca878&#x27;);<br>select * from dt;<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111703656.png" srcset="/img/loading1.gif" lazyload alt="image-20220411170318569"></p>
<h2 id="3-打包新镜像"><a href="#3-打包新镜像" class="headerlink" title="3 打包新镜像"></a>3 打包新镜像</h2><ul>
<li>退出镜像</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs bash">quit();<br><span class="hljs-built_in">exit</span><br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111706145.png" srcset="/img/loading1.gif" lazyload alt="image-20220411170653064"></p>
<ul>
<li>获得容器ID</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">docker ps -a<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111708916.png" srcset="/img/loading1.gif" lazyload alt="image-20220411170809761"></p>
<ul>
<li>打包</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">docker commit 容器<span class="hljs-built_in">id</span> 要保存的镜像名称<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111710251.png" srcset="/img/loading1.gif" lazyload alt="image-20220411171027162"></p>
<ul>
<li>查看</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">docker images<br></code></pre></td></tr></table></figure>

<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204111711817.png" srcset="/img/loading1.gif" lazyload alt="image-20220411171108709"></p>
<h2 id="4-wsl2部署docker"><a href="#4-wsl2部署docker" class="headerlink" title="4 wsl2部署docker"></a>4 wsl2部署docker</h2><h3 id="4-1-原生部署"><a href="#4-1-原生部署" class="headerlink" title="4.1 原生部署"></a>4.1 原生部署</h3><p>即使用上述方法，原生部署linux docker</p>
<h3 id="4-2-docker-desktop-for-windows"><a href="#4-2-docker-desktop-for-windows" class="headerlink" title="4.2 docker desktop for windows"></a>4.2 docker desktop for windows</h3><p><strong>Windows 安装docker desktop ,wsl2可以使用</strong></p>
<ul>
<li><p>下载应用</p>
<p><a target="_blank" rel="noopener" href="https://www.docker.com/products/docker-desktop/">下载链接</a></p>
</li>
<li><p>默认安装，一路下一步</p>
<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204182008720.png" srcset="/img/loading1.gif" lazyload alt="image-20220418200802552"></p>
</li>
<li><p>在wsl2中启用</p>
<ul>
<li><p>启用基于<code>WSL2</code>的引擎</p>
<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204182009968.png" srcset="/img/loading1.gif" lazyload alt="image-20220418200924854"></p>
</li>
<li><p>允许安装的linux发行版使用</p>
<p><img src="https://cdn.jsdelivr.net/gh/F7kyyy/picture@main/img/202204182010263.png" srcset="/img/loading1.gif" lazyload alt="image-20220418201010181"></p>
<h2 id="5-docker-配置"><a href="#5-docker-配置" class="headerlink" title="5 docker 配置"></a>5 docker 配置</h2><h3 id="5-1-为容器配置代理"><a href="#5-1-为容器配置代理" class="headerlink" title="5.1 为容器配置代理"></a>5.1 为容器配置代理</h3><p>更改<code>C:\Users\UserName\.docker\config.json</code>文件，更改之后，新建立的容器就会默认使用代理</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><code class="hljs json"><span class="hljs-punctuation">&#123;</span><br>    <span class="hljs-attr">&quot;credsStore&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;desktop&quot;</span><span class="hljs-punctuation">,</span><br>    <span class="hljs-attr">&quot;proxies&quot;</span><span class="hljs-punctuation">:</span> <br>    <span class="hljs-punctuation">&#123;</span><br>        <span class="hljs-attr">&quot;default&quot;</span><span class="hljs-punctuation">:</span> <br>        <span class="hljs-punctuation">&#123;</span><br>            <span class="hljs-attr">&quot;httpProxy&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;http://host.docker.internal:10811&quot;</span><span class="hljs-punctuation">,</span><br>            <span class="hljs-attr">&quot;httpsProxy&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;http://host.docker.internal:10811&quot;</span><span class="hljs-punctuation">,</span><br>            <span class="hljs-attr">&quot;noProxy&quot;</span><span class="hljs-punctuation">:</span> <span class="hljs-string">&quot;docker-registry.somecorporation.com,*.test.example.com,.example2.com&quot;</span><br>        <span class="hljs-punctuation">&#125;</span><br>    <span class="hljs-punctuation">&#125;</span><br><span class="hljs-punctuation">&#125;</span><br></code></pre></td></tr></table></figure>

<p><code>不能使用127.0.0.1,Port应该使用局域网的端口，V2rayN 就是10811，clash就是7890</code></p>
<h3 id="5-2-安装常见容器"><a href="#5-2-安装常见容器" class="headerlink" title="5.2 安装常见容器"></a>5.2 安装常见容器</h3><h4 id="5-2-1-Ubuntu-20-04"><a href="#5-2-1-Ubuntu-20-04" class="headerlink" title="5.2.1 Ubuntu 20.04"></a>5.2.1 Ubuntu 20.04</h4><ul>
<li><p>安装</p>
<p><code>挂载</code></p>
</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs dock"># 拉取镜像<br>docker pull ubuntu:latest<br># -p 端口转发 -v 将/root挂载到本地<br>docker run -it -p 50022:22 --name ubuntu -v C:\Users\FengisZZZ\Documents\DockerFiles\DockerUbuntu\root\:/root/ -d ubuntu:latest<br></code></pre></td></tr></table></figure>

<ul>
<li><p>换源</p>
<p>需要安装<code>ca-certificates</code>,之后正常换源</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs bash">apt install ca-certificates<br></code></pre></td></tr></table></figure></li>
</ul>
<h4 id="5-3-2-Mysql"><a href="#5-3-2-Mysql" class="headerlink" title="5.3.2 Mysql"></a>5.3.2 Mysql</h4><ul>
<li><p>安装</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs bash"><span class="hljs-comment"># 拉取镜像</span><br>docker pull mysql:latest<br><span class="hljs-comment"># 启动</span><br>docker run --name=mysql -it -p 3306:3306 -e MYSQL_ROOT_PASSWORD=040057 -v C:\Users\FengisZZZ\Documents\DockerFiles\DockerMysql\data:/var/lib/mysql-files <br>-v C:\Users\FengisZZZ\Documents\DockerFiles\DockerMysql\conf:/etc/mysql -v C:\Users\FengisZZZ\Documents\DockerFiles\DockerMysql\<span class="hljs-built_in">log</span>:/var/log/mysql -d mysql<br></code></pre></td></tr></table></figure></li>
</ul>
</li>
</ul>
</li>
</ul>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E4%BA%91%E8%AE%A1%E7%AE%97/" class="category-chain-item">云计算</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE/" class="print-no-link">#环境配置</a>
      
        <a href="/tags/%E4%BA%91%E8%AE%A1%E7%AE%97/" class="print-no-link">#云计算</a>
      
        <a href="/tags/Ubuntu/" class="print-no-link">#Ubuntu</a>
      
        <a href="/tags/%E5%AE%9E%E9%AA%8C%E6%8A%A5%E5%91%8A/" class="print-no-link">#实验报告</a>
      
        <a href="/tags/wsl/" class="print-no-link">#wsl</a>
      
        <a href="/tags/docker/" class="print-no-link">#docker</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>配置docker</div>
      <div>http://example.com/2022/04/18/配置docker/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Feng Zikai</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2022年4月18日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a class="print-no-link" target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2022/04/19/heroku%E9%85%8D%E7%BD%AEv2ray/" title="heroku配置v2ray">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">heroku配置v2ray</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2022/04/18/%E4%BA%91%E8%AE%A1%E7%AE%97%E4%BD%9C%E4%B8%9A3/" title="云计算作业3">
                        <span class="hidden-mobile">云计算作业3</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header">
    <i class="iconfont icon-list"></i>
    <span>目录</span>
  </p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> <div style="font-size: 0.85rem"> <span id="timeDate">载入天数...</span> <span id="times">载入时分秒...</span> <script src="/js/duration.js"></script> </div> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.4/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.20.1/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>




  
<script src="//cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<script src="//cdn.jsdelivr.net/gh/metowolf/Metingjs@1.2/dist/Meting.min.js"></script>
<script src="//cdn.bootcss.com/animejs/2.2.0/anime.min.js"></script>



<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
